#if (FEATURE_MODE == 0)
/**
 @file ctc_sc_oam_cli.c

 @date 2019-4-12

 @version v6.0

 The file apply clis of sc oam module
*/

#include "sal.h"
#include "ctc_cli.h"
#include "ctc_cli_common.h"
#include "ctc_debug.h"
#include "ctc_error.h"
#include "ctc_api.h"
#include "ctcs_api.h"
#include "ctc_sc_oam.h"


#define CTC_SC_OAM_BER_THRD_STR "(TIME DDEG_DETECT DDEG_CLEAR DEXC_DETECT DEXC_CLEAR)"
#define CTC_SC_OAM_BER_THRD_DESC \
               "Detect time for ber",\
               "Threshold for ddeg set, unit:10^(-13)",\
               "Threshold for ddeg clear, unit:10^(-13)",\
               "Threshold for dexc set, unit:10^(-13)",\
               "Threshold for dexc clear, unit:10^(-13)"

#define CTC_SC_OAM_MEP \
               "(client-id ID) {mep-en MEP_EN| speed SPEED| rx-en-bmp BMP0| tx-en-bmp BMP1|\
        bas {rx-period RX_PERIOD | tx-period TX_PERIOD | seq-mod SEQ_MODE | seq-num SEQ | ber-thrd "CTC_SC_OAM_BER_THRD_STR" |bip-check BIP| rei-check CHECK| rei-thrd "CTC_SC_OAM_BER_THRD_STR" |\
             cs-lpi CS_LPI| cs-lf CS_LF| cs-rf CS_RF |rdi RDI} |\
        aps {aps-interval INTERVAL | trigger-aps COUNT} |\
        aps-cmd COMMAND |\
        cv  {cv-interval INTERVAL | sapi SAPI0 SAPI1 SAPI2 SAPI3 SAPI4 SAPI5 SAPI6 SAPI7 SAPI8 SAPI9 SAPI10 SAPI11 SAPI12 SAPI13 SAPI14 SAPI15 | dapi DAPI0 DAPI1 DAPI2 DAPI3 DAPI4 DAPI5 DAPI6 DAPI7 DAPI8 DAPI9 DAPI10 DAPI11 DAPI12 DAPI13 DAPI14 DAPI15} |\
        dm  {dm-interval-1dm INTERVAL| dm-interval-2dm INTERVAL} |\
        cs  {cs-interval INTERVAL | cs-type TYPE} | }"

#define CTC_SC_OAM_MEP_DESC \
               "Client id",\
               "Client id",\
               "Mep enable",\
               "Value",\
               "Speed of client, unit:1G, must multiple of 5G",\
               "Speed value",\
               "Rx process enable if set corresponding type",\
               "Bitmap value",\
               "Tx process enable if set corresponding type",\
               "Bitmap value",\
               "BAS configuration",\
               "Rx period for BAS",\
               "Period",\
               "Tx period for BAS",\
               "Period",\
               "Sequence number mode. 0: cyclic value for 0 to 15; 1: fixed value",\
               "Sequence number mode",\
               "Sequence number in fixed value mode",\
               "Sequence number",\
               "BER threshold",\
               CTC_SC_OAM_BER_THRD_DESC,\
               "BIP check enable",\
               "Value",\
               "REI check enable",\
               "Value",\
               "REI threshold",\
               CTC_SC_OAM_BER_THRD_DESC,\
               "CS LPI",\
               "CS LPI value",\
               "CS LF",\
               "CS LF value",\
               "CS RF",\
               "CS RF value",\
               "RDI",\
               "RDI value",\
               "APS configuration",\
               "TX interval, unit: one second",\
               "Interval",\
               "Trigger fast tx aps",\
               "Aps fast tx count",\
               "Aps command",\
               "command, 0-LO;1-FS;2-MS_TO_P;3-MS_TO_W;4-EXER;5-CLEAR;6-FREEZE;7-CLEAR_FREEZE;8-SF;9-RSF;10-SD;11-RSD",\
               "CV configuration",\
               "TX interval, unit: one second",\
               "Interval",\
               "SAPI",\
               "Value of SAPI0",\
               "Value of SAPI1",\
               "Value of SAPI2",\
               "Value of SAPI3",\
               "Value of SAPI4",\
               "Value of SAPI5",\
               "Value of SAPI6",\
               "Value of SAPI7",\
               "Value of SAPI8",\
               "Value of SAPI9",\
               "Value of SAPI10",\
               "Value of SAPI11",\
               "Value of SAPI12",\
               "Value of SAPI13",\
               "Value of SAPI14",\
               "Value of SAPI15",\
               "DAPI",\
               "Value of DAPI0",\
               "Value of DAPI1",\
               "Value of DAPI2",\
               "Value of DAPI3",\
               "Value of DAPI4",\
               "Value of DAPI5",\
               "Value of DAPI6",\
               "Value of DAPI7",\
               "Value of DAPI8",\
               "Value of DAPI9",\
               "Value of DAPI10",\
               "Value of DAPI11",\
               "Value of DAPI12",\
               "Value of DAPI13",\
               "Value of DAPI14",\
               "Value of DAPI15",\
               "DM configuration",\
               "1DM TX interval, unit: one second",\
               "Interval",\
               "2DM TX interval, unit: one second",\
               "Interval",\
               "CS configuration",\
               "TX interval, unit: one second",\
               "Interval",\
               "CS type",\
               "Type"

CTC_CLI(ctc_cli_sc_oam_add_mep,
        ctc_cli_sc_oam_add_mep_cmd,
        "sc-oam (add|update|remove)"CTC_SC_OAM_MEP,
        CTC_CLI_SC_OAM_M_STR,
        "Add SC OAM Mep",
        "Update SC OAM Mep",
        "Remove SC OAM Mep",
        CTC_SC_OAM_MEP_DESC
        )
{

    ctc_sc_oam_mep_t mep;
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    uint8 enable = 0;

    sal_memset(&mep, 0 ,sizeof(mep));
    index = CTC_CLI_GET_ARGC_INDEX("client-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("client-id", mep.client_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("mep-en");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("mep-en", enable, argv[index + 1]);
        if (enable)
        {
            CTC_SET_FLAG(mep.flag, CTC_SC_OAM_MEP_FLAG_MEP_EN);
        }
    }
    index = CTC_CLI_GET_ARGC_INDEX("speed");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT16("speed", mep.client_speed, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rx-en-bmp");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("rx-en-bmp", mep.rx_en_bmp, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-en-bmp");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("tx-en-bmp", mep.tx_en_bmp, argv[index + 1]);
    }

    /*BAS configuration*/
    index = CTC_CLI_GET_ARGC_INDEX("rx-period");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("rx-period", mep.bas_rx_period, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-period");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("tx-period", mep.bas_tx_period, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-mod");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("seq-mod", mep.bas_seq_mode, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-num");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("seq-num", mep.bas_seq, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("ber-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("detect-time", mep.ber_thrd.ber_detect_time, argv[index + 1]);
        CTC_CLI_GET_UINT32("ddeg-detect", mep.ber_thrd.ddeg_set_thrd, argv[index + 2]);
        CTC_CLI_GET_UINT32("ddeg-clear", mep.ber_thrd.ddeg_clear_thrd, argv[index + 3]);
        CTC_CLI_GET_UINT32("dexc-detect", mep.ber_thrd.dexc_set_thrd, argv[index + 4]);
        CTC_CLI_GET_UINT32("dexc-clear", mep.ber_thrd.dexc_clear_thrd, argv[index + 5]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("bip-check");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("bip-check", enable, argv[index + 1]);
        if (enable)
        {
            CTC_SET_FLAG(mep.flag, CTC_SC_OAM_MEP_FLAG_BIP_CHK_EN);
        }
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-check");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("rei-check", enable, argv[index + 1]);
        if (enable)
        {
            CTC_SET_FLAG(mep.flag, CTC_SC_OAM_MEP_FLAG_REI_CHK_EN);
        }
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("detect-time", mep.rei_thrd.ber_detect_time, argv[index + 1]);
        CTC_CLI_GET_UINT32("ddeg-detect", mep.rei_thrd.ddeg_set_thrd, argv[index + 2]);
        CTC_CLI_GET_UINT32("ddeg-clear", mep.rei_thrd.ddeg_clear_thrd, argv[index + 3]);
        CTC_CLI_GET_UINT32("dexc-detect", mep.rei_thrd.dexc_set_thrd, argv[index + 4]);
        CTC_CLI_GET_UINT32("dexc-clear", mep.rei_thrd.dexc_clear_thrd, argv[index + 5]);
    }
    /*APS*/
    index = CTC_CLI_GET_ARGC_INDEX("aps-interval");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("aps-interval", mep.aps_interval, argv[index + 1]);
    }
    /*CV*/
    index = CTC_CLI_GET_ARGC_INDEX("cv-interval");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("cv-interval", mep.cv_interval, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("sapi");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sapi0",   mep.sapi[0], argv[index + 1]);
        CTC_CLI_GET_UINT8("sapi1",   mep.sapi[1], argv[index + 2]);
        CTC_CLI_GET_UINT8("sapi2",   mep.sapi[2], argv[index + 3]);
        CTC_CLI_GET_UINT8("sapi3",   mep.sapi[3], argv[index + 4]);
        CTC_CLI_GET_UINT8("sapi4",   mep.sapi[4], argv[index + 5]);
        CTC_CLI_GET_UINT8("sapi5",   mep.sapi[5], argv[index + 6]);
        CTC_CLI_GET_UINT8("sapi6",   mep.sapi[6], argv[index + 7]);
        CTC_CLI_GET_UINT8("sapi7",   mep.sapi[7], argv[index + 8]);
        CTC_CLI_GET_UINT8("sapi8",   mep.sapi[8], argv[index + 9]);
        CTC_CLI_GET_UINT8("sapi9",   mep.sapi[9], argv[index + 10]);
        CTC_CLI_GET_UINT8("sapi10",  mep.sapi[10], argv[index + 11]);
        CTC_CLI_GET_UINT8("sapi11",  mep.sapi[11], argv[index + 12]);
        CTC_CLI_GET_UINT8("sapi12",  mep.sapi[12], argv[index + 13]);
        CTC_CLI_GET_UINT8("sapi13",  mep.sapi[13], argv[index + 14]);
        CTC_CLI_GET_UINT8("sapi14",  mep.sapi[14], argv[index + 15]);
        CTC_CLI_GET_UINT8("sapi15",  mep.sapi[15], argv[index + 16]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dapi");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("dapi0",   mep.dapi[0], argv[index + 1]);
        CTC_CLI_GET_UINT8("dapi1",   mep.dapi[1], argv[index + 2]);
        CTC_CLI_GET_UINT8("dapi2",   mep.dapi[2], argv[index + 3]);
        CTC_CLI_GET_UINT8("dapi3",   mep.dapi[3], argv[index + 4]);
        CTC_CLI_GET_UINT8("dapi4",   mep.dapi[4], argv[index + 5]);
        CTC_CLI_GET_UINT8("dapi5",   mep.dapi[5], argv[index + 6]);
        CTC_CLI_GET_UINT8("dapi6",   mep.dapi[6], argv[index + 7]);
        CTC_CLI_GET_UINT8("dapi7",   mep.dapi[7], argv[index + 8]);
        CTC_CLI_GET_UINT8("dapi8",   mep.dapi[8], argv[index + 9]);
        CTC_CLI_GET_UINT8("dapi9",   mep.dapi[9], argv[index + 10]);
        CTC_CLI_GET_UINT8("dapi10",  mep.dapi[10], argv[index + 11]);
        CTC_CLI_GET_UINT8("dapi11",  mep.dapi[11], argv[index + 12]);
        CTC_CLI_GET_UINT8("dapi12",  mep.dapi[12], argv[index + 13]);
        CTC_CLI_GET_UINT8("dapi13",  mep.dapi[13], argv[index + 14]);
        CTC_CLI_GET_UINT8("dapi14",  mep.dapi[14], argv[index + 15]);
        CTC_CLI_GET_UINT8("dapi15",  mep.dapi[15], argv[index + 16]);
    }
    /*DM*/
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-1dm");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("dm-interval-1dm", mep.one_dm_interval, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-2dm");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("dm-interval-2dm", mep.two_dm_interval, argv[index + 1]);
    }
    /*CS*/
    index = CTC_CLI_GET_ARGC_INDEX("cs-interval");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("cs-interval", mep.cs_interval, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-type");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("cs-type", mep.cs_type, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("add");
    if (0xFF != index)
    {
        if (g_ctcs_api_en)
        {
            ret = ctcs_sc_oam_add_mep(g_api_ldev, &mep);
        }
        else
        {
            ret = ctc_sc_oam_add_mep(g_api_ldev, &mep);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("update");
    if (0xFF != index)
    {
        if (g_ctcs_api_en)
        {
            ret = ctcs_sc_oam_update_mep(g_api_ldev, &mep);
        }
        else
        {
            ret = ctc_sc_oam_update_mep(g_api_ldev, &mep);
        }
    }

    index = CTC_CLI_GET_ARGC_INDEX("remove");
    if (0xFF != index)
    {
        if (g_ctcs_api_en)
        {
            ret = ctcs_sc_oam_remove_mep(g_api_ldev, &mep);
        }
        else
        {
            ret = ctc_sc_oam_remove_mep(g_api_ldev, &mep);
        }
    }

    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_set_mep,
        ctc_cli_sc_oam_set_mep_cmd,
        "sc-oam set "CTC_SC_OAM_MEP,
        CTC_CLI_SC_OAM_M_STR,
        "Set SC OAM Mep",
        CTC_SC_OAM_MEP_DESC
        )
{
    ctc_sc_oam_mep_prop_t prop;
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_ber_thrd_t thrd;
    ctc_sc_oam_aps_info_t aps_info;
    uint8 api[16] = {0};

    sal_memset(&prop, 0 ,sizeof(ctc_sc_oam_mep_prop_t));
    sal_memset(&thrd, 0 ,sizeof(ctc_sc_oam_ber_thrd_t));
    sal_memset(&aps_info, 0 ,sizeof(ctc_sc_oam_aps_info_t));
    index = CTC_CLI_GET_ARGC_INDEX("client-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("client-id", prop.client_id, argv[index + 1]);
    }

    prop.prop_type = CTC_SC_OAM_MEP_PROP_MAX;

    index = CTC_CLI_GET_ARGC_INDEX("ber-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("detect-time", thrd.ber_detect_time, argv[index + 1]);
        CTC_CLI_GET_UINT32("ddeg-detect", thrd.ddeg_set_thrd, argv[index + 2]);
        CTC_CLI_GET_UINT32("ddeg-clear", thrd.ddeg_clear_thrd, argv[index + 3]);
        CTC_CLI_GET_UINT32("dexc-detect", thrd.dexc_set_thrd, argv[index + 4]);
        CTC_CLI_GET_UINT32("dexc-clear", thrd.dexc_clear_thrd, argv[index + 5]);
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BER_THRD;
        prop.p_update_value = &thrd;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-thrd");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("detect-time", thrd.ber_detect_time, argv[index + 1]);
        CTC_CLI_GET_UINT32("ddeg-detect", thrd.ddeg_set_thrd, argv[index + 2]);
        CTC_CLI_GET_UINT32("ddeg-clear", thrd.ddeg_clear_thrd, argv[index + 3]);
        CTC_CLI_GET_UINT32("dexc-detect", thrd.dexc_set_thrd, argv[index + 4]);
        CTC_CLI_GET_UINT32("dexc-clear", thrd.dexc_clear_thrd, argv[index + 5]);
        prop.prop_type = CTC_SC_OAM_MEP_PROP_REI_THRD;
        prop.p_update_value = &thrd;
    }
    index = CTC_CLI_GET_ARGC_INDEX("aps-info");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("request-state", aps_info.request_state, argv[index + 1]);
        CTC_CLI_GET_UINT8("protection-type", aps_info.protection_type, argv[index + 2]);
        CTC_CLI_GET_UINT8("requested-signal", aps_info.requested_signal, argv[index + 3]);
        CTC_CLI_GET_UINT8("bridged-signal", aps_info.bridged_signal, argv[index + 4]);
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_INFO;
        prop.p_update_value = &aps_info;
    }

    index = CTC_CLI_GET_ARGC_INDEX("sapi");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("sapi0",   api[0], argv[index + 1]);
        CTC_CLI_GET_UINT8("sapi1",   api[1], argv[index + 2]);
        CTC_CLI_GET_UINT8("sapi2",   api[2], argv[index + 3]);
        CTC_CLI_GET_UINT8("sapi3",   api[3], argv[index + 4]);
        CTC_CLI_GET_UINT8("sapi4",   api[4], argv[index + 5]);
        CTC_CLI_GET_UINT8("sapi5",   api[5], argv[index + 6]);
        CTC_CLI_GET_UINT8("sapi6",   api[6], argv[index + 7]);
        CTC_CLI_GET_UINT8("sapi7",   api[7], argv[index + 8]);
        CTC_CLI_GET_UINT8("sapi8",   api[8], argv[index + 9]);
        CTC_CLI_GET_UINT8("sapi9",   api[9], argv[index + 10]);
        CTC_CLI_GET_UINT8("sapi10",   api[10], argv[index + 11]);
        CTC_CLI_GET_UINT8("sapi11",   api[11], argv[index + 12]);
        CTC_CLI_GET_UINT8("sapi12",   api[12], argv[index + 13]);
        CTC_CLI_GET_UINT8("sapi13",   api[13], argv[index + 14]);
        CTC_CLI_GET_UINT8("sapi14",   api[14], argv[index + 15]);
        CTC_CLI_GET_UINT8("sapi15",   api[15], argv[index + 16]);
        prop.prop_type = CTC_SC_OAM_MEP_PROP_SAPI;
        prop.p_update_value = api;
    }
    index = CTC_CLI_GET_ARGC_INDEX("dapi");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("dapi0",   api[0], argv[index + 1]);
        CTC_CLI_GET_UINT8("dapi1",   api[1], argv[index + 2]);
        CTC_CLI_GET_UINT8("dapi2",   api[2], argv[index + 3]);
        CTC_CLI_GET_UINT8("dapi3",   api[3], argv[index + 4]);
        CTC_CLI_GET_UINT8("dapi4",   api[4], argv[index + 5]);
        CTC_CLI_GET_UINT8("dapi5",   api[5], argv[index + 6]);
        CTC_CLI_GET_UINT8("dapi6",   api[6], argv[index + 7]);
        CTC_CLI_GET_UINT8("dapi7",   api[7], argv[index + 8]);
        CTC_CLI_GET_UINT8("dapi8",   api[8], argv[index + 9]);
        CTC_CLI_GET_UINT8("dapi9",   api[9], argv[index + 10]);
        CTC_CLI_GET_UINT8("dapi10",   api[10], argv[index + 11]);
        CTC_CLI_GET_UINT8("dapi11",   api[11], argv[index + 12]);
        CTC_CLI_GET_UINT8("dapi12",   api[12], argv[index + 13]);
        CTC_CLI_GET_UINT8("dapi13",   api[13], argv[index + 14]);
        CTC_CLI_GET_UINT8("dapi14",   api[14], argv[index + 15]);
        CTC_CLI_GET_UINT8("dapi15",   api[15], argv[index + 16]);
        prop.prop_type = CTC_SC_OAM_MEP_PROP_DAPI;
        prop.p_update_value = api;
    }

    index = CTC_CLI_GET_ARGC_INDEX("mep-en");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_MEP_EN;
        CTC_CLI_GET_UINT32("mep-en", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("speed");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CLIENT_SPEED;
        CTC_CLI_GET_UINT32("speed", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rx-en-bmp");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_RX_EN_BMP;
        CTC_CLI_GET_UINT32("rx-en-bmp", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-en-bmp");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_TX_EN_BMP;
        CTC_CLI_GET_UINT32("tx-en-bmp", prop.update_value, argv[index + 1]);
    }

    /*BAS configuration*/
    index = CTC_CLI_GET_ARGC_INDEX("rx-period");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_RX_PERIOD;
        CTC_CLI_GET_UINT32("rx-period", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-period");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_TX_PERIOD;
        CTC_CLI_GET_UINT32("tx-period", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-mod");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_SEQ_MODE;
        CTC_CLI_GET_UINT32("seq-mod", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-num");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_SEQ;
        CTC_CLI_GET_UINT32("seq-num", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-check");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_REI_CHK_EN;
        CTC_CLI_GET_UINT32("rei-check", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("bip-check");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BIP_CHK_EN;
        CTC_CLI_GET_UINT32("bip-check", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lpi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_LPI;
        CTC_CLI_GET_UINT32("cs-lpi", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lf");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_LF;
        CTC_CLI_GET_UINT32("cs-lf", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-rf");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_RF;
        CTC_CLI_GET_UINT32("cs-rf", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rdi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_RDI;
        CTC_CLI_GET_UINT32("rdi", prop.update_value, argv[index + 1]);
    }

    /*APS*/
    index = CTC_CLI_GET_ARGC_INDEX("aps-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_INTERVAL;
        CTC_CLI_GET_UINT32("aps-interval", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("trigger-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_TX_RAPID;
        CTC_CLI_GET_UINT32("trigger-aps", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("aps-cmd");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_CMD;
        CTC_CLI_GET_UINT8("aps-cmd", prop.update_value, argv[index + 1]);
    }
    /*CV*/
    index = CTC_CLI_GET_ARGC_INDEX("cv-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CV_INTERVAL;
        CTC_CLI_GET_UINT32("cv-interval", prop.update_value, argv[index + 1]);
    }

    /*DM*/
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-1dm");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_1DM_INTERVAL;
        CTC_CLI_GET_UINT32("dm-interval-1dm", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-2dm");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_2DM_INTERVAL;
        CTC_CLI_GET_UINT32("dm-interval-2dm", prop.update_value, argv[index + 1]);
    }
    /*CS*/
    index = CTC_CLI_GET_ARGC_INDEX("cs-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_INTERVAL;
        CTC_CLI_GET_UINT32("cs-interval", prop.update_value, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-type");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_TYPE;
        CTC_CLI_GET_UINT32("cs-type", prop.update_value, argv[index + 1]);
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_set_mep_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_set_mep_property(g_api_ldev, &prop);
    }

    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_get_mep,
        ctc_cli_sc_oam_get_mep_cmd,
        "show sc-oam client-id ID {mep-en| speed| rx-en-bmp| tx-en-bmp|\
        bas {rx-period| tx-period| seq-mod| seq-num| ber-thrd| bip-check| rei-check| rei-thrd| cs-lpi| cs-lf| cs-rf|rdi} |\
        aps {aps-interval} |\
        cv  {cv-interval| sapi| dapi} |\
        dm  {dm-interval-1dm| dm-interval-2dm} |\
        cs  {cs-interval| cs-type} |\
        aps-info | ber-cnt |}",
        CTC_CLI_SHOW_STR,
        CTC_CLI_SC_OAM_M_STR,
        "Client id",\
        "Client id",\
        "Mep enable",\
        "Speed of client, unit:1G, must multiple of 5G",\
        "Rx process enable if set corresponding type",\
        "Tx process enable if set corresponding type",\
        "BAS configuration",\
        "Rx period for BAS",\
        "Tx period for BAS",\
        "Sequence number mode. 0: cyclic value for 0 to 15; 1: fixed value",\
        "Sequence number in fixed value mode",\
        "BER threshold",\
        "BIP check enable",\
        "REI check enable",\
        "REI threshold",\
        "CS LPI",\
        "CS LF",\
        "CS RF",\
        "RDI",\
        "APS configuration",\
        "TX interval, unit: one second",\
        "CV configuration",\
        "TX interval, unit: one second",\
        "SAPI",\
        "DAPI",\
        "DM configuration",\
        "1DM TX interval, unit: one second",\
        "2DM TX interval, unit: one second",\
        "CS configuration",\
        "TX interval, unit: one second",\
        "CS type",\
        "APS information",\
        "Ber stats"
        )
{
    ctc_sc_oam_mep_prop_t prop;
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_ber_thrd_t thrd;
    ctc_sc_oam_aps_info_t aps_info;
    uint8 api[16] = {0};
    char sapi[128];
    char dapi[128];
    uint8 i = 0;
    ctc_sc_oam_mep_t mep;
    char* period[] = {"16K", "32K", "64K", "512K"};
    ctc_sc_oam_ber_cnt_t* p_ber = NULL;

    sal_memset(&prop, 0 ,sizeof(ctc_sc_oam_mep_prop_t));
    sal_memset(&thrd, 0 ,sizeof(ctc_sc_oam_ber_thrd_t));
    sal_memset(&aps_info, 0 ,sizeof(ctc_sc_oam_aps_info_t));
    sal_memset(&mep, 0, sizeof(mep));

    CTC_CLI_GET_UINT32("client-id", mep.client_id, argv[0]);


    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_get_mep(g_api_ldev, &mep);
    }
    else
    {
        ret = ctc_sc_oam_get_mep(g_api_ldev, &mep);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% %s \n", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    prop.client_id = mep.client_id;
    index = CTC_CLI_GET_ARGC_INDEX("client-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("client-id", prop.client_id, argv[index + 1]);
    }

    prop.prop_type = CTC_SC_OAM_MEP_PROP_MAX;

    index = CTC_CLI_GET_ARGC_INDEX("ber-thrd");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BER_THRD;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-thrd");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_REI_THRD;
    }
    index = CTC_CLI_GET_ARGC_INDEX("aps-info");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_INFO;
    }

    index = CTC_CLI_GET_ARGC_INDEX("sapi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_SAPI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("dapi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_DAPI;
    }

    index = CTC_CLI_GET_ARGC_INDEX("mep-en");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_MEP_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("speed");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CLIENT_SPEED;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rx-en-bmp");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_RX_EN_BMP;
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-en-bmp");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_TX_EN_BMP;
    }

    /*BAS configuration*/
    index = CTC_CLI_GET_ARGC_INDEX("rx-period");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_RX_PERIOD;
    }
    index = CTC_CLI_GET_ARGC_INDEX("tx-period");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_TX_PERIOD;
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-mod");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_SEQ_MODE;
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-num");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BAS_SEQ;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-check");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_REI_CHK_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("bip-check");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BIP_CHK_EN;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lpi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_LPI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lf");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_LF;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-rf");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_RF;
    }
    index = CTC_CLI_GET_ARGC_INDEX("rdi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_RDI;
    }

    /*APS*/
    index = CTC_CLI_GET_ARGC_INDEX("aps-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_INTERVAL;
    }
    index = CTC_CLI_GET_ARGC_INDEX("trigger-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_TX_RAPID;
    }
    index = CTC_CLI_GET_ARGC_INDEX("aps-cmd");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_CMD;
    }
    /*CV*/
    index = CTC_CLI_GET_ARGC_INDEX("cv-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CV_INTERVAL;
    }

    /*DM*/
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-1dm");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_1DM_INTERVAL;
    }
    index = CTC_CLI_GET_ARGC_INDEX("dm-interval-2dm");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_2DM_INTERVAL;
    }
    /*CS*/
    index = CTC_CLI_GET_ARGC_INDEX("cs-interval");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_INTERVAL;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-type");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_CS_TYPE;
    }
    index = CTC_CLI_GET_ARGC_INDEX("ber-cnt");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_MEP_PROP_BER_CNT;
    }
    prop.p_update_value=(uint32*)mem_malloc(MEM_CLI_MODULE, sizeof(uint32)*5);
     if (NULL ==  prop.p_update_value)
    {
        return CLI_ERROR;
    }
    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_get_mep_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_get_mep_property(g_api_ldev, &prop);
    }
    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    ctc_cli_out("  %-14s:%u\n", "client_id", prop.client_id);
    switch (prop.prop_type)
    {
        case CTC_SC_OAM_MEP_PROP_MEP_EN:
            ctc_cli_out("  %-14s:%d\n", "mep_en", prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CLIENT_SPEED:
            ctc_cli_out("  %-14s:%d\n", "speed", (uint16)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_RX_EN_BMP:
            ctc_cli_out("  %-14s:%d\n", "rx_en_bmp", prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_TX_EN_BMP:
            ctc_cli_out("  %-14s:%d\n", "tx_en_bmp", prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_BIP_CHK_EN:
            ctc_cli_out("  %-14s:%d\n", "ber_chk_en", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_REI_CHK_EN:
            ctc_cli_out("  %-14s:%d\n", "rei_chk_en", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_BAS_RX_PERIOD:
            ctc_cli_out("  %-14s:%s\n", "rx_period", period[(uint8)prop.update_value]);
            break;
        case CTC_SC_OAM_MEP_PROP_BAS_TX_PERIOD:
            ctc_cli_out("  %-14s:%s\n", "tx_period", period[(uint8)prop.update_value]);
            break;
        case CTC_SC_OAM_MEP_PROP_BAS_SEQ_MODE:
            ctc_cli_out("  %-14s:%d\n", "seq_mode", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_BAS_SEQ:
            ctc_cli_out("  %-14s:%d\n", "seq", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_BER_THRD:
            ctc_cli_out("  ber_thrd-->\n");
            sal_memcpy(&thrd,prop.p_update_value, sizeof(thrd));
            ctc_cli_out("    %-12s:%-12u\n", "detect_time", thrd.ber_detect_time);
            ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "ddeg_detect", thrd.ddeg_set_thrd, "ddeg_clear",thrd.ddeg_clear_thrd);
            ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "dexc_detect", thrd.dexc_set_thrd, "dexc_clear", thrd.dexc_clear_thrd);
            break;
        case CTC_SC_OAM_MEP_PROP_REI_THRD:
            ctc_cli_out("  rei_thrd-->\n");
            sal_memcpy(&thrd,prop.p_update_value, sizeof(thrd));
            ctc_cli_out("    %-12s:%-12u\n", "detect_time", thrd.ber_detect_time);
            ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "ddeg_detect", thrd.ddeg_set_thrd, "ddeg_clear",thrd.ddeg_clear_thrd);
            ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "dexc_detect", thrd.dexc_set_thrd, "dexc_clear", thrd.dexc_clear_thrd);
            break;
        case CTC_SC_OAM_MEP_PROP_CS_LPI:
            ctc_cli_out("  %-14s:%u\n", "cs_lpi", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CS_LF:
            ctc_cli_out("  %-14s:%u\n", "cs_lf", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CS_RF:
            ctc_cli_out("  %-14s:%u\n", "cs_rf", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_RDI:
            ctc_cli_out("  %-14s:%u\n", "rdi", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CV_INTERVAL:
            ctc_cli_out("  %-14s:%u\n", "cv_interval", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_SAPI:
            sal_memcpy(&api,prop.p_update_value, sizeof(api));
            for(i=0;i<16;i++)
            {
                sal_sprintf(&(sapi[i*2]), "%02x", api[i]);
            }
            ctc_cli_out("  %-14s:%sh\n", "sapi", sapi);
            break;
        case CTC_SC_OAM_MEP_PROP_DAPI:
            sal_memcpy(&api,prop.p_update_value, sizeof(api));
            for(i=0;i<16;i++)
            {
                sal_sprintf(&(dapi[i*2]), "%02x", api[i]);
            }
            ctc_cli_out("  %-14s:%sh\n", "dapi", dapi);
            break;
        case CTC_SC_OAM_MEP_PROP_1DM_INTERVAL:
            ctc_cli_out("  %-14s:%d\n", "1dm_interval", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_2DM_INTERVAL:
            ctc_cli_out("  %-14s:%u\n", "2dm_interval", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CS_INTERVAL:
            ctc_cli_out("  %-14s:%u\n", "cs_interval", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_CS_TYPE:
            ctc_cli_out("  %-14s:%u\n", "cs_type", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_APS_INTERVAL:
            ctc_cli_out("  %-14s:%u\n", "aps_interval", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_APS_TX_RAPID:
            ctc_cli_out("  %-14s:%u\n", "trigger_aps", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_APS_INFO:
            ctc_cli_out("  aps_info-->\n");
            #if defined E_UNIT && (FEATURE_MODE == 0)
            sal_memcpy(&aps_info,prop.p_update_value, sizeof(aps_info));
            ctc_cli_out("    %-14s:%u\n", "aps_en", (uint8)aps_info.aps_en);
            ctc_cli_out("    %-14s:%u\n", "is_protection", (uint8)aps_info.is_protection);
            ctc_cli_out("    %-14s:%u\n", "sc_aps_en", (uint8)aps_info.sc_aps_en);
            ctc_cli_out("    %-14s:%u\n", "wtr_timer", (uint8)aps_info.wtr_timer);
            ctc_cli_out("    %-14s:%u\n", "w_client_id", aps_info.w_client_id);
            ctc_cli_out("    %-14s:%u\n", "aps_bridge_group_id", (uint16)aps_info.aps_bridge_group_id);
            #endif
            ctc_cli_out("    aps_param-->\n");
            #if defined E_UNIT && (FEATURE_MODE == 0)
            ctc_cli_out("      %-14s:%u\n", "last_state", (uint8)aps_info.last_state);
            ctc_cli_out("      %-14s:%u\n", "current_state", (uint8)aps_info.current_state);
            #endif
            ctc_cli_out("      %-14s:%u\n", "request_state", (uint8)aps_info.request_state);
            ctc_cli_out("      %-14s:%u\n", "protection_type", (uint8)aps_info.protection_type);
            ctc_cli_out("      %-14s:%u\n", "requested_signal", (uint8)aps_info.requested_signal);
            ctc_cli_out("      %-14s:%u\n", "bridged_signal", (uint8)aps_info.bridged_signal);
            break;
        case CTC_SC_OAM_MEP_PROP_APS_CMD:
            ctc_cli_out("  %-14s:%u\n", "aps_cmd", (uint8)prop.update_value);
            break;
        case CTC_SC_OAM_MEP_PROP_BER_CNT:
            p_ber = (ctc_sc_oam_ber_cnt_t*)(prop.p_update_value);
            ctc_cli_out("  %-14s:%u\n", "bip_cnt", p_ber->bip_cnt);
            ctc_cli_out("  %-14s:%u\n", "rei_cnt", p_ber->rei_cnt);
            break;
        default:
            break;

    }
   mem_free(prop.p_update_value);

    return CLI_SUCCESS;
}

#define CTC_SC_OAM_APS_INFO_STR "aps-info {enable | protection| sc-aps | wtr-timer TIMER| working-client CLIENT_ID | aps-grp-id GRP_ID |\
                                   aps-param REQUEST_STATE PROTECTION_TYPE REQUESTED_SIGNAL BRIDGED_SIGNAL | }"
#define CTC_SC_OAM_APS_INFO_DESC \
               "APS information",\
               "APS Enable",\
               "Is protection mep",\
               "SPN channel APS",\
               "WTR timer",\
               "WTR timer, unit:1min",\
               "Working client",\
               "Working client",\
               "APS group id",\
               "APS group id",\
               "Aps param",\
               "Request state",\
               "Protection type",\
               "Requested signal",\
               "Bridged signal"

CTC_CLI(ctc_cli_sc_oam_set_aps,
        ctc_cli_sc_oam_set_aps_cmd,
        "sc-oam set (client-id ID)" CTC_SC_OAM_APS_INFO_STR ,
        CTC_CLI_SC_OAM_M_STR,
        "Set SC OAM Mep",
        "Client id",
        "Client id",
        CTC_SC_OAM_APS_INFO_DESC
        )
{
    ctc_sc_oam_mep_prop_t prop;
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_aps_info_t aps_info;

    sal_memset(&prop, 0 ,sizeof(ctc_sc_oam_mep_prop_t));
    sal_memset(&aps_info, 0 ,sizeof(ctc_sc_oam_aps_info_t));
    index = CTC_CLI_GET_ARGC_INDEX("client-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("client-id", prop.client_id, argv[index + 1]);
    }
    prop.prop_type = CTC_SC_OAM_MEP_PROP_APS_INFO;
    prop.p_update_value = &aps_info;

    index = CTC_CLI_GET_ARGC_INDEX("enable");
    if (0xFF != index)
    {
        aps_info.aps_en = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("protection");
    if (0xFF != index)
    {
        aps_info.is_protection = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("sc-aps");
    if (0xFF != index)
    {
        aps_info.sc_aps_en = 1;
    }
    index = CTC_CLI_GET_ARGC_INDEX("wtr-timer");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("wtr-timer", aps_info.wtr_timer, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("working-client");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT32("working-client", aps_info.w_client_id, argv[index + 1]);
    }
    index = CTC_CLI_GET_ARGC_INDEX("aps-grp-id");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT16("aps-grp-id", aps_info.aps_bridge_group_id, argv[index + 1]);
    }


    index = CTC_CLI_GET_ARGC_INDEX("aps-param");
    if (0xFF != index)
    {
        CTC_CLI_GET_UINT8("request-state", aps_info.request_state, argv[index + 1]);
        CTC_CLI_GET_UINT8("protection-type", aps_info.protection_type, argv[index + 2]);
        CTC_CLI_GET_UINT8("requested-signal", aps_info.requested_signal, argv[index + 3]);
        CTC_CLI_GET_UINT8("bridged-signal", aps_info.bridged_signal, argv[index + 4]);
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_set_mep_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_set_mep_property(g_api_ldev, &prop);
    }

    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}


CTC_CLI(ctc_cli_sc_oam_show_mep,
        ctc_cli_sc_oam_show_mep_cmd,
        "show sc-oam mep client-id ID ",
        CTC_CLI_SHOW_STR,
        CTC_CLI_SC_OAM_M_STR,
        "Mep configuration and infomation",
        "Client id",
        "Client id"
        )
{
    int32 ret = CLI_SUCCESS;
    ctc_sc_oam_mep_t mep;
    ctc_sc_oam_mep_info_t mep_info;
    char sapi[128];
    char dapi[128];
    uint8 i = 0;
    char* period[] = {"16K", "32K", "64K", "512K"};

    sal_memset(&mep, 0, sizeof(mep));
    sal_memset(&mep_info, 0, sizeof(ctc_sc_oam_mep_info_t));
    CTC_CLI_GET_UINT32("client-id", mep.client_id, argv[0]);

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_get_mep(g_api_ldev, &mep);
    }
    else
    {
        ret = ctc_sc_oam_get_mep(g_api_ldev, &mep);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% %s \n", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    mep_info.client_id = mep.client_id;
    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_get_mep_info(g_api_ldev, &mep_info);
    }
    else
    {
        ret = ctc_sc_oam_get_mep_info(g_api_ldev, &mep_info);
    }

    if (ret < 0)
    {
        ctc_cli_out("%% %s \n", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("--------------------MEP Config--------------------\n");
    ctc_cli_out("COMMON-->\n");
    ctc_cli_out("  %-14s:%u\n", "client_id", mep.client_id);
    ctc_cli_out("  %-14s:%-12d%-14s:%d\n", "speed", mep.client_speed, "mep_en", CTC_FLAG_ISSET(mep.flag, CTC_SC_OAM_MEP_FLAG_MEP_EN));
    ctc_cli_out("  %-14s:0x%-10x%-14s:0x%x\n", "rx_en_bmp", mep.rx_en_bmp, "tx_en_bmp", mep.tx_en_bmp);
    ctc_cli_out("BAS-->\n");
    ctc_cli_out("  %-14s:%-12s%-14s:%s\n", "rx_period", period[mep.bas_rx_period], "tx_period", period[mep.bas_tx_period]);
    ctc_cli_out("  %-14s:%-12d%-14s:%d\n", "seq_mode", mep.bas_seq_mode, "seq", mep.bas_seq);
    ctc_cli_out("  %-14s:%-12d\n", "rei_chk_en", CTC_FLAG_ISSET(mep.flag, CTC_SC_OAM_MEP_FLAG_REI_CHK_EN));
    ctc_cli_out("  %-14s:%-12d\n", "ber_chk_en", CTC_FLAG_ISSET(mep.flag, CTC_SC_OAM_MEP_FLAG_BIP_CHK_EN));
    ctc_cli_out("  ber_thrd-->\n");
    ctc_cli_out("    %-12s:%-12u\n", "detect_time", mep.ber_thrd.ber_detect_time);
    ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "ddeg_detect", mep.ber_thrd.ddeg_set_thrd, "ddeg_clear", mep.ber_thrd.ddeg_clear_thrd);
    ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "dexc_detect", mep.ber_thrd.dexc_set_thrd, "dexc_clear", mep.ber_thrd.dexc_clear_thrd);
    ctc_cli_out("  rei_thrd-->\n");
    ctc_cli_out("    %-12s:%-12u\n", "detect_time", mep.rei_thrd.ber_detect_time);
    ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "ddeg_detect", mep.rei_thrd.ddeg_set_thrd, "ddeg_clear", mep.rei_thrd.ddeg_clear_thrd);
    ctc_cli_out("    %-12s:%-12u%-14s:%u\n", "dexc_detect", mep.rei_thrd.dexc_set_thrd, "dexc_clear", mep.rei_thrd.dexc_clear_thrd);
    ctc_cli_out("APS-->\n");
    ctc_cli_out("  %-14s:%-12d\n", "interval", mep.aps_interval);
    ctc_cli_out("CV-->\n");
    ctc_cli_out("  %-14s:%-12d\n", "interval", mep.cv_interval);

    for(i=0;i<16;i++)
    {
        sal_sprintf(&(sapi[i*2]), "%02x", mep.sapi[i]);
        sal_sprintf(&(dapi[i*2]), "%02x", mep.dapi[i]);
    }

    ctc_cli_out("  %-14s:%sh\n", "sapi", sapi);
    ctc_cli_out("  %-14s:%sh\n", "dapi", dapi);
    ctc_cli_out("DM-->\n");
    ctc_cli_out("  %-14s:%-12d%-14s:%d\n", "1dm_interval", mep.one_dm_interval, "2dm_interval", mep.two_dm_interval);
    ctc_cli_out("CS-->\n");
    ctc_cli_out("  %-14s:%-12d%-14s:%d\n", "interval", mep.cs_interval, "type", mep.cs_type);

    ctc_cli_out("--------------------MEP Status--------------------\n");
    ctc_cli_out("LOCAL-->\n");
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d%-9s:%-8d\n", "cs_lpi", mep_info.cs_lpi, "cs_lf", mep_info.cs_lf, "cs_rf", mep_info.cs_rf);
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d%-9s:%-8d\n", "rdi", mep_info.rdi, "dloc", mep_info.dloc, "ddeg", mep_info.ddeg);
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d%-9s:%-8d\n", "dexc", mep_info.dexc, "cs_chk", mep_info.cs_type_chk, "sapi_chk", mep_info.sapi_chk);
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d\n", "dapi_chk", mep_info.dapi_chk, "first_rx", mep_info.first_rx);
    ctc_cli_out("REMOTE-->\n");
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d%-9s:%-8d\n", "cs_lpi", mep_info.remote_cs_lpi, "cs_lf", mep_info.remote_cs_lf, "cs_rf", mep_info.remote_cs_rf);
    ctc_cli_out("  %-9s:%-8d%-9s:%-8d%-9s:%-8d\n\n", "rdi", mep_info.remote_rdi, "ddeg", mep_info.ddeg_rei, "dexc", mep_info.dexc_rei);

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_set_global,
        ctc_cli_sc_oam_set_global_cmd,
        "sc-oam global (hw-aps ENABLE | ( defect-to-cpu | defect-to-rdi | defect-to-aps)\
        {cs-lpi|cs-lf|cs-rf|rdi|dexc|ddeg|rei-dexc|rei-ddeg|d-loc|first-rx|\
        seq-chk|sapi-chk|dapi-chk|cs-type-chk|bas-period-chk|crc-check |all |} )",
        CTC_CLI_SC_OAM_M_STR,
        "Global config",
        "HW APS enable",
        "HW APS enable",
        "Defect to CPU",
        "Defect to RDI",
        "Defect to aps switch",
        "Remote CS_LPI changed",
        "Remote CS_LF changed",
        "Remote CS_RF changed",
        "RX RDI changed",
        "Set or clear dexc",
        "Set or clear ddeg",
        "Set or clear dexc for REI",
        "Set or clear ddeg for REI",
        "Set or clear dloc",
        "Receive BAS first time, means session established",
        "Sequence number check",
        "SAPI check fail",
        "DAPI check fail",
        "CS type check fail",
        "BAS RX period check",
        "Rx crc check fail",
        "All defect  to CPU/APS"
        )
{
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_prop_t prop;

    sal_memset(&prop, 0, sizeof(prop));

    index = CTC_CLI_GET_ARGC_INDEX("hw-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_HW_APS_SWTICH;
        CTC_CLI_GET_UINT32("hw-aps", prop.value, argv[index + 1]);
    }

    index = CTC_CLI_GET_ARGC_INDEX("defect-to-cpu");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_CPU;
    }
    index = CTC_CLI_GET_ARGC_INDEX("defect-to-rdi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_RDI;
    }
    index = CTC_CLI_GET_ARGC_INDEX("defect-to-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_APS_SWTICH;
    }
    index = CTC_CLI_GET_ARGC_INDEX("all");
    if (index != 0xff)
    {
        prop.value = 0xFFFFFFFF;
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lpi");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_CSLPI);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-lf");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_CSLF);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-rf");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_CSRF);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rdi");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_RDI);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dexc");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DEXC);
    }
    index = CTC_CLI_GET_ARGC_INDEX("ddeg");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DDEG);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-dexc");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DEXC_REI);
    }
    index = CTC_CLI_GET_ARGC_INDEX("rei-ddeg");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DDEG_REI);
    }
    index = CTC_CLI_GET_ARGC_INDEX("d-loc");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DLOC);
    }
    index = CTC_CLI_GET_ARGC_INDEX("first-rx");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_FIRST_RX);
    }
    index = CTC_CLI_GET_ARGC_INDEX("seq-chk");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_SEQ_CHK);
    }
    index = CTC_CLI_GET_ARGC_INDEX("sapi-chk");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_SAPI_CHK);
    }
    index = CTC_CLI_GET_ARGC_INDEX("dapi-chk");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_DAPI_CHK);
    }
    index = CTC_CLI_GET_ARGC_INDEX("cs-type-chk");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_CS_TYPE_CHK);
    }
    index = CTC_CLI_GET_ARGC_INDEX("bas-period-chk");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_PERIOD_CHK);
    }
    index = CTC_CLI_GET_ARGC_INDEX("crc-check");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_DEFECT_CRC_CHK);
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_set_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_set_property(g_api_ldev, &prop);
    }

    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_set_global_event,
        ctc_cli_sc_oam_set_global_event_cmd,
        "sc-oam global event-to-cpu {aps-rx|other-pdu|invalid-pdu |}",
        CTC_CLI_SC_OAM_M_STR,
        "Global config",
        "Event to CPU",
        "RX APS PDU",
        "RX other PDU",
        "RX invalid PDU"
        )
{
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_prop_t prop;
    sal_memset(&prop, 0, sizeof(prop));

    prop.prop_type = CTC_SC_OAM_PROP_EVENT_TO_CPU;

    index = CTC_CLI_GET_ARGC_INDEX("aps-rx");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_EVENT_TYPE_APS_RX);
    }
    index = CTC_CLI_GET_ARGC_INDEX("other-pdu");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_EVENT_TYPE_OTHER_PDU);
    }
    index = CTC_CLI_GET_ARGC_INDEX("invalid-pdu");
    if (0xFF != index)
    {
        CTC_SET_FLAG(prop.value, CTC_SC_OAM_EVENT_TYPE_INVALID_PDU);
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_set_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_set_property(g_api_ldev, &prop);
    }

    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }
    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_get_global,
        ctc_cli_sc_oam_get_global_cmd,
        "show sc-oam global (hw-aps | ( defect-to-cpu | defect-to-rdi | defect-to-aps | event-to-cpu))",
        CTC_CLI_SHOW_STR,
        CTC_CLI_SC_OAM_M_STR,
        "Global config",
        "HW APS enable",
        "Defect to CPU",
        "Defect to RDI",
        "Defect to APS",
        "Event to CPU")
{
    char* desc[20] =
    {
        "cs-lpi",
        "cs-lf",
        "cs-rf",
        "rdi",
        "dexc",
        "ddeg",
        "rei-dexc",
        "rei-ddeg",
        "d-loc",
        "first-rx",
        "seq-chk",
        "sapi-chk",
        "dapi-chk",
        "cs-type-chk",
        "bas-period-chk",
        "crc-check",
    };
    uint32 index = 0xFF;
    int32 ret = CLI_ERROR;
    ctc_sc_oam_prop_t prop;

    sal_memset(&prop, 0, sizeof(prop));

    index = CTC_CLI_GET_ARGC_INDEX("hw-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_HW_APS_SWTICH;
    }

    index = CTC_CLI_GET_ARGC_INDEX("defect-to-cpu");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_CPU;
    }

    index = CTC_CLI_GET_ARGC_INDEX("defect-to-rdi");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_RDI;
    }

    index = CTC_CLI_GET_ARGC_INDEX("defect-to-aps");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_DEFECT_TO_APS_SWTICH;
    }

    index = CTC_CLI_GET_ARGC_INDEX("event-to-cpu");
    if (0xFF != index)
    {
        prop.prop_type = CTC_SC_OAM_PROP_EVENT_TO_CPU;
    }

    if (g_ctcs_api_en)
    {
        ret = ctcs_sc_oam_get_property(g_api_ldev, &prop);
    }
    else
    {
        ret = ctc_sc_oam_get_property(g_api_ldev, &prop);
    }
    if (ret)
    {
        ctc_cli_out("%% %s \n\r", ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("--------------------Sc-oam Global Config--------------------\n");
    if  (CTC_SC_OAM_PROP_HW_APS_SWTICH == prop.prop_type)
    {
        ctc_cli_out("  %-14s:0x%x\n", "hw-aps", prop.value);
    }
    else if (CTC_SC_OAM_PROP_EVENT_TO_CPU == prop.prop_type)
    {
        ctc_cli_out("  Event-to-CPU               Value\n");
        ctc_cli_out("-----------------------------------\n");
        ctc_cli_out("  %-25s:%s\n", "aps-rx", CTC_FLAG_ISSET(prop.value, CTC_SC_OAM_EVENT_TYPE_APS_RX)?"Y":"N");
        ctc_cli_out("  %-25s:%s\n", "other-pdu", CTC_FLAG_ISSET(prop.value, CTC_SC_OAM_EVENT_TYPE_OTHER_PDU)?"Y":"N");
        ctc_cli_out("  %-25s:%s\n", "invalid-pdu", CTC_FLAG_ISSET(prop.value, CTC_SC_OAM_EVENT_TYPE_INVALID_PDU)?"Y":"N");

    }
    else
    {
        uint8 i = 0;
        ctc_cli_out("  DefectType                 Value\n");
        ctc_cli_out("-----------------------------------\n");
        for (i = 0; i < 20; i++)
       {
            if (CTC_IS_BIT_SET(prop.value, i))
            {
                ctc_cli_out( "  %-25s:%s\n", desc[i],"Y");
            }
            else
            {
                ctc_cli_out( "  %-25s:%s\n", desc[i],"N");
            }
        }
   }

    return CLI_SUCCESS;
}


CTC_CLI(ctc_cli_sc_oam_debug_on,
        ctc_cli_sc_oam_debug_on_cmd,
        "debug sc-oam (ctc|sys) (debug-level {func|param|info|error} |)",
        CTC_CLI_DEBUG_STR,
        CTC_CLI_SC_OAM_M_STR,
        "CTC Layer",
        "SYS Layer",
        CTC_CLI_DEBUG_LEVEL_STR,
        CTC_CLI_DEBUG_LEVEL_FUNC,
        CTC_CLI_DEBUG_LEVEL_PARAM,
        CTC_CLI_DEBUG_LEVEL_INFO,
        CTC_CLI_DEBUG_LEVEL_ERROR)
{
    uint8 level = CTC_DEBUG_LEVEL_NONE;
    uint8 index = 0;

    index = CTC_CLI_GET_ARGC_INDEX("debug-level");
    if (index != 0xFF)
    {
        level = CTC_DEBUG_LEVEL_NONE;
        index = CTC_CLI_GET_ARGC_INDEX("func");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_FUNC;
        }

        index = CTC_CLI_GET_ARGC_INDEX("param");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_PARAM;
        }

        index = CTC_CLI_GET_ARGC_INDEX("info");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_INFO;
        }

        index = CTC_CLI_GET_ARGC_INDEX("error");
        if (index != 0xFF)
        {
            level |= CTC_DEBUG_LEVEL_ERROR;
        }
    }
    else
    {
        level = CTC_DEBUG_LEVEL_FUNC | CTC_DEBUG_LEVEL_INFO | CTC_DEBUG_LEVEL_PARAM | CTC_DEBUG_LEVEL_ERROR;
    }

    index = CTC_CLI_GET_ARGC_INDEX("ctc");
    if (index != 0xff)
    {
        ctc_debug_set_flag("sc_oam", "sc_oam", SC_OAM_CTC, level, TRUE);
    }
    else
    {
        ctc_debug_set_flag("sc_oam", "sc_oam", SC_OAM_SYS, level, TRUE);
    }

    return CLI_SUCCESS;
}

CTC_CLI(ctc_cli_sc_oam_debug_off,
        ctc_cli_sc_oam_debug_off_cmd,
        "no debug sc-oam (ctc|sys)",
        CTC_CLI_NO_STR,
        CTC_CLI_DEBUG_STR,
        CTC_CLI_SC_OAM_M_STR,
        "CTC Layer",
        "SYS Layer")
{
    uint8 index = 0;
    uint8 level  = 0;

    index = CTC_CLI_GET_ARGC_INDEX("ctc");
    if (index != 0xff)
    {
        ctc_debug_set_flag("sc_oam", "sc_oam", SC_OAM_CTC, level, FALSE);
    }
    else
    {
        ctc_debug_set_flag("sc_oam", "sc_oam", SC_OAM_SYS, level, FALSE);
    }

    return CLI_SUCCESS;
}

int32
ctc_sc_oam_cli_init(void)
{
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_add_mep_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_set_mep_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_get_mep_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_set_aps_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_show_mep_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_set_global_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_get_global_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_debug_on_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_debug_off_cmd);
    install_element(CTC_SDK_MODE, &ctc_cli_sc_oam_set_global_event_cmd);

    return CLI_SUCCESS;
}
#endif

